package com.cxb.apipassenger.controller;

import com.alibaba.nacos.common.model.RestResult;
import com.cxb.apipassenger.remote.ServiceOrderClient;
import com.cxb.internalcommon.dto.OrderInfo;
import com.cxb.internalcommon.dto.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class TestController {

    @GetMapping("/test")
    public String test(){
        log.info("test-----");
        return "test api";
    }

    @Autowired
    ServiceOrderClient serviceOrderClient;

    //测试派单服务
    @GetMapping("/test-real-order/{orderId}")
    public String dispatch(@PathVariable("orderId")long orderId){

        System.out.println("api-passenger-并发测试:orderId"+orderId);
        serviceOrderClient.dispatch(orderId);
        return "test-real-time success";
    }


    /*
    * 有token可以正常返回
    * */
    @GetMapping("/authTest")
    public ResponseResult authtest(){
        return ResponseResult.success("auth test");
    }

    /*
    * 没有token能正常返回*/
    @GetMapping("/noauthTest")
    public  ResponseResult noauthtest(){
        return ResponseResult.success("noauth test");
    }
}
